import { request } from '@/utils';
import { getRestBaseUrl, getEcpQueryBaseUrl, getIopDataBaseUrl } from '@/config';

export const getChannelStore = channelCode =>
  request({
    url: `${getRestBaseUrl()}/iop/channelStoreService/get`,
    method: 'POST',
    data: { channelCode },
    timeout: 3 * 60 * 1000,
  });

export const getSales = (channelCode, goodsCode) =>
  request({
    url: `${getRestBaseUrl()}/iop/salesService/getSalesDetail`,
    method: 'POST',
    data: { channelCode, goodsCode },
    timeout: 3 * 60 * 1000,
  });

//获取药品信息
export const getGoodsCategoryInfo = (goodsCode = null) =>
  request({
    url: `${getEcpQueryBaseUrl()}query/GoodsQueryService/getGoodsCategoryInfo`,
    method: 'POST',
    data: { goodsCode },
    timeout: 3 * 60 * 1000,
  });

//获取竞对门店
export const listCompeteStores = (topChannelCode = null, storeNames = null, goodsCodes = null) =>
  request({
    url: `${getIopDataBaseUrl()}/iop-data/goodsService/listByCodes`,
    method: 'POST',
    data: { topChannelCode, storeNames, goodsCodes },
    timeout: 3 * 60 * 1000,
  });
